document.addEventListener('DOMContentLoaded', function() {
    const loginForm = document.getElementById('loginForm');
    const loginButton = document.getElementById('loginButton');

    loginForm.addEventListener('submit', function(e) {
        e.preventDefault();
        const phone = document.getElementById('phone').value;
        const password = document.getElementById('password').value;

        if (phone && password) {
            // 这里应该是发送到服务器的登录/注册请求
            console.log('登录/注册请求发送', { phone, password });
            loginOrRegister(phone, password);
        } else {
            alert('请填写所有字段');
        }
    });
    
    function loginOrRegister(phone, password) {
        // 模拟API请求
        setTimeout(() => {
            console.log('登录/注册成功');
            alert('登录/注册成功！');
            // 这里可以添加登录成功后的操作，比如跳转到主页
        }, 1000);
    }



    function loadLogin() {
        fetch('login/login.html')
            .then(response => response.text())
            .then(data => {
                document.getElementById('login-container').innerHTML = data;
            });
    }
});